#include"udpserver.hpp"
#include"dictionary.hpp"


int main(int argc,char* argv[])
{
    if(argc != 2)
    {   
        std::cerr << "usage:" << argv[0] << " port"<<std::endl;
        exit(3);
    }
    Dictionary dic;
    dic.Load();
    std::unique_ptr<UdpServer> server = std::make_unique<UdpServer>(std::stoi(argv[1]),[&dic](const std::string& word,const InetAddr& client)->std::string 
{
    return dic.Translate(word,client);
});
    server->Init();
    server->Start();

    return 0;
}